<template>
	<view class="projectSearch conTainer">
		<view class="searchText f16">
			类型
		</view>
		<view>
			<uni-data-checkbox v-model="formData.instituteType" :localdata="type" />
		</view>
		<view class="searchText f16">
			项目类型
		</view>
		<view>
			<uni-easyinput :clear="false" type="text" v-model="formData.content" placeholder="请输入项目的描述如市场" />
		</view>
		<view class="searchText f16">
			开始时间
		</view>
		<view>
			<uni-datetime-picker type="date" :clear-icon="true" v-model="formData.projectStartTime" />
		</view>
		<view class="searchText f16">
			项目标签
		</view>
		<view>
			<uni-easyinput type="text" :clear="false" v-model="tags" placeholder="请输入项目的描述标签" />
		</view>
		<view class="button">
			<view type="primary" class="button_item f14 margin-right16" @click="reset">重置</view>
			<view type="primary" class="button_item f14" @click="search">搜索</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tags: '',
				formData: {
					tags: [],
					content: '',
					projectStartTime: '',
					instituteType: '2'
				},
				type: [{
						text: "理科",
						value: '1',
					},
					{
						text: "文科",
						value: '0',
					},
					{
						text: "不限",
						value: '2',
					},
				],
			}
		},
		methods: {
			search() {
				console.log(666);
				let data;
				if (!this.tags) {
					data = {
						...this.formData,
						tags: []
					}
				} else {
					let newTags = [this.tags]
					data = {
						...this.formData,
						tags: newTags
					}
				}
				console.log(data, 76);
				this.$emit('closePopup')
				this.$nextTick(() => {
					this.$emit('searctReload', data)
				})
			},
			reset() {
				this.tags = ''
				this.formData.instituteType = '2'
				this.formData.content = ''
				this.formData.projectStartTime = ''
			},
			change(e) {
				this.formData.type = e
			}
		}
	}
</script>

<style scoped lang="less">
	.projectSearch {
		height: 70vh;
		background-color: #fff;

		.uni-select__selector {
			z-index: 99;
		}

		.button {
			display: flex;
			margin-top: 15rpx;
			justify-content: center;

			&_item {
				width: auto;
				background-color: #2ebef3;
				color: #fff;
				padding: 15rpx 35rpx;
				border-radius: 15rpx;
			}
		}

		.searchText {

			margin: 15rpx 0;
		}
	}
</style>
